let toggleLoading = (el,binding)=>{
  let {value, modifiers,oldValue} = binding;
  if(value){
    if(modifiers.fullWindow){
      $('body').append(`<div class="window-loading-main full-height">
      <div class="svg-bg"></div>
    </div>`)
    }else{
      $(el).append(`<div class="window-loading-main">
        <div class="svg-bg"></div>
      </div>`)
    }
    $('body').css('overflow','hidden');
  }else{
    $('.window-loading-main').remove();
    $('body').css('overflow','auto');
  }
}
export default{
  
  bind(el,binding){
    toggleLoading(el,binding)
  },
  update(el,binding){
    if (binding.oldValue !== binding.value) {
      toggleLoading(el, binding);
    }
  },
}